﻿
@{
    ViewData["Title"] = "Index";
}
<script src="~/lib/jquery/dist/jquery.js"></script>
<link href="~/js/Uploader6.1.css" rel="stylesheet" />
<script src="~/js/Uploader6.1.js"></script>
<h2>后台缩略图生成</h2>

<br /><br /><br />
<div>
    上传文件名：
    <span id="name"></span>
    <br />
    <br />
    相对目录： <span id="relativeName"></span>
</div>
<br /><br /><br />
<div class="uploader uploader-default" id="uploadBtn"></div>
<br />
<br />小图：
<img id="small" />
<br /><br />大图：
<img id="big" />
<script>
    /*******使用WebScoket 方式处理传输*******/
    var uploader = $('#uploadBtn').uploader({
        url: 'ws://localhost:11545/common/socket_thumb',
        fileExts: 'jpg;png;gif;',
        handleType: '1',
        text: '选择图片',
        onSuccess: function (data) {
            console.info(data);
            $('#name').text(data.newName);
            $('#relativeName').text(data.relativeName);

            $('#small').attr('src', data.Data.small);
            $('#big').attr('src', data.Data.big);
        }
    });

        ///*******使用Ajax 方式处理传输*******/
        //var uploader = $('#uploadBtn').uploader({
        //    url: '../common/ajax_thumb',
        //    fileExts: 'jpg;png;gif;',
        //    handleType:'1',
        //    text: '选择图片',
        //    onSuccess: function (data) {
        //            console.info(data);
        //    $('#name').text(data.newName);
        //    $('#relativeName').text(data.relativeName);

        //    $('#small').attr('src', data.Data.small);
        //    $('#big').attr('src', data.Data.big);
        //    }
        //});
</script>